
*********************************************************************************
********************************* MAIN ANALYSES *********************************
*********************************************************************************

* Set Working Directory
cd "C:\Users\14258\Dropbox\Projects\Rural Economic Ideology\Analysis"

* Load Data
use ANES2020_Coded, clear


****** Figure 2 — Distributions of Rural Consciousness and Political Engagement ******
sum ruralconsc, det // 5th to 95th percentiles of rural consciousness are .4444444 and 1
sum engagement, det // 5th to 95th percentiles of political engagement are .2666667 and .925

hist ruralconsc [fweight=fwt], bin(19) percent title({bf:A. Rural Consciousness})
hist engagement [fweight=fwt], bin(19) percent title({bf:B. Political Engagement})


******* Appendix Table 2B — Pairwise Correlates of Rural Consciousness and Political Engagement *******
pwcorr ruralconsc engagement male white black hispanic asian age education income parent married union unemployed_household antiblack_stereotyping religion church northeast midwest south west [aweight=weight], star(0.05)


******* Multiple Imputation ******
set seed 1996 // Author birth year
mi set wide
mi register imputed income male black hispanic asian native education parent married union unemployed_household age antiblack_stereotyping religion church poorhealth raceres ownstock class //note: no missings in race/gender covariates, but included to help impute other variables. 
mi impute chained (logit) male black hispanic asian native parent married union unemployed_household ownstock (reg) income education age antiblack_stereotyping religion church poorhealth raceres class, add(25) // reduce if you want to reproduce ~99% similar results in less than half the time. 

mi svyset [pweight = weight], psu(psu) strata(strata) // weights + complex sampling design features


******* Figure 1 — Political Engagement and Instrumental versus Symbolic Politics  ********

* Panel A: PID Importance as Function of Engagement
quietly mi estimate: svy: regress pid_importance engagement
mimrgns, at(engagement=(0(.25)1)) post
quietly mi estimate: svy: regress pid_importance engagement i.male i.race c.age c.education c.income i.parent i.married i.union i.unemployed_household c.religion c.church i.state c.antiblack_stereotyping c.pid01
mimrgns, at(engagement=(0(.25)1)) post

* Panel B: Redistribution as Functions of Income and Partisanship
quietly mi estimate: svy: regress redistribution c.income_rev##c.engagement i.male##c.engagement i.race##c.engagement c.age##c.engagement c.education##c.engagement i.parent##c.engagement i.married##c.engagement i.union##c.engagement c.religion##c.engagement c.church##c.engagement i.state c.pid01##c.engagement c.antiblack_stereotyping##c.engagement
mimrgns, dydx(income_rev) at(engagement=(0(.25)1)) atmeans 
mimrgns, dydx(pid01) at(engagement=(0(.25)1)) atmeans 

* Panel C: Redistribution as Functions of Stock Ownership and Partisanship
quietly mi estimate: svy: regress redistribution c.ownstock_no##c.engagement i.male##c.engagement i.race##c.engagement c.age##c.engagement c.education##c.engagement i.parent##c.engagement i.married##c.engagement i.union##c.engagement c.religion##c.engagement c.church##c.engagement i.state c.pid01##c.engagement c.antiblack_stereotyping##c.engagement
mimrgns, dydx(ownstock_no) at(engagement=(0(.25)1)) atmeans 
mimrgns, dydx(pid01) at(engagement=(0(.25)1)) atmeans 

* Panel D: Redistribution as Functions of Social Class and Partisanship
quietly mi estimate: svy: regress redistribution c.lowclass##c.engagement i.male##c.engagement i.race##c.engagement c.age##c.engagement c.education##c.engagement i.parent##c.engagement i.married##c.engagement i.union##c.engagement c.religion##c.engagement c.church##c.engagement i.state c.pid01##c.engagement c.antiblack_stereotyping##c.engagement
mimrgns, dydx(lowclass) at(engagement=(0(.25)1)) atmeans 
mimrgns, dydx(pid01) at(engagement=(0(.25)1)) atmeans 

* Panel E: Job Guarantee as Functions of Unemployment and Partisanship
quietly mi estimate: svy: regress jobguarantee c.unemployed_household##c.engagement i.male##c.engagement i.race##c.engagement c.age##c.engagement c.education##c.engagement i.parent##c.engagement i.married##c.engagement i.union##c.engagement c.religion##c.engagement c.church##c.engagement i.state c.pid01##c.engagement c.antiblack_stereotyping##c.engagement
mimrgns, dydx(unemployed_household) at(engagement=(0(.25)1)) atmeans 
mimrgns, dydx(pid01) at(engagement=(0(.25)1)) atmeans 

* Panel F: Healthcare as Functions of General Health and Partisanship
quietly mi estimate: svy: regress healthcare c.poorhealth##c.engagement i.male##c.engagement i.race##c.engagement c.age##c.engagement c.education##c.engagement i.parent##c.engagement i.married##c.engagement i.union##c.engagement c.religion##c.engagement c.church##c.engagement i.state c.pid01##c.engagement c.antiblack_stereotyping##c.engagement
mimrgns, dydx(poorhealth) at(engagement=(0(.25)1)) atmeans 
mimrgns, dydx(pid01) at(engagement=(0(.25)1)) atmeans 


***** Figure 3 — Conditional Associations of Rural Consciousness with Partisanship and Ideological Identity *******

* Conditional Relationships
foreach dv in latent_leftright pid01 ft_demrep ft_bidentrump trump_disapproval candpref2020 ideo01 ft_libcon  {
quietly mi estimate: svy: regress `dv' c.ruralconsc##c.engagement i.male##c.engagement i.race##c.engagement c.age##c.engagement c.education##c.engagement c.income##c.engagement i.parent##c.engagement i.married##c.engagement i.union##c.engagement i.unemployed##c.engagement c.religion##c.engagement c.church##c.engagement c.antiblack_stereotyping##c.engagement i.state
    quietly mimrgns, at(ruralconsc=(.4444444 1) engagement=(.2666667 .4315 .596 .7605 .925)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]
}

* Unconditional Relationship (not plotted, but referenced in text)
quietly mi estimate: svy: regress latent_leftright c.ruralconsc##c.engagement i.male##c.engagement i.race##c.engagement c.age##c.engagement c.education##c.engagement c.income##c.engagement i.parent##c.engagement i.married##c.engagement i.union##c.engagement i.unemployed##c.engagement c.religion##c.engagement c.church##c.engagement c.antiblack_stereotyping##c.engagement i.state
    mimrgns, at(ruralconsc=(.4444444 1)) coeflegend post
	lincom _b[2._at]-_b[1._at]


***** Figure 4 — Conditional Associations of Rural Consciousness with Economic Preferences *******

* Conditional Relationships
foreach dv in econ_liberalism obamacare govt_insurance health_spending spendingservices jobguarantee poor_spending schools_spending ss_spending welfare_spending millionaire_tax inequality_reduction minwage regulations ubi healthcare {
quietly mi estimate: svy: regress `dv' c.ruralconsc##c.engagement i.male##c.engagement i.race##c.engagement c.age##c.engagement c.education##c.engagement c.income##c.engagement i.parent##c.engagement i.married##c.engagement i.union##c.engagement i.unemployed##c.engagement c.religion##c.engagement c.church##c.engagement c.antiblack_stereotyping##c.engagement i.state
    quietly mimrgns, at(ruralconsc=(.4444444 1) engagement=(.2666667 .4315 .596 .7605 .925)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]
}

* Unconditional Relationship (not plotted, but referenced in text)
quietly mi estimate: svy: regress econ_liberalism c.ruralconsc##c.engagement i.male##c.engagement i.race##c.engagement c.age##c.engagement c.education##c.engagement c.income##c.engagement i.parent##c.engagement i.married##c.engagement i.union##c.engagement i.unemployed##c.engagement c.religion##c.engagement c.church##c.engagement c.antiblack_stereotyping##c.engagement i.state
    mimrgns, at(ruralconsc=(.4444444 1)) coeflegend post
	lincom _b[2._at]-_b[1._at]


***** Figure 5 — Conditional Associations of Rural Consciousness to Trade Preferences ***** 

* Conditional Relationships
foreach dv in imports freetrade {
mi estimate: svy: regress `dv' c.ruralconsc##c.engagement i.male##c.engagement i.race##c.engagement c.age##c.engagement c.education##c.engagement c.income##c.engagement i.parent##c.engagement i.married##c.engagement i.union##c.engagement i.unemployed##c.engagement c.religion##c.engagement c.church##c.engagement c.antiblack_stereotyping##c.engagement i.state
    quietly mimrgns, at(ruralconsc=(.4444444 1) engagement=(.2666667 .4315 .596 .7605 .925)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]
}


*********************************************************************************
******************************* APPENDIX ANALYSES *******************************
*********************************************************************************

****** Appendix 2A: Justification for Coding "Haven't though much about this" ideology responses to midpoint with "Moderates" ******

* Multinomial Ideology, 4-Category
gen ideo4cat = 1 if V201200 == 1 | V201200 == 2 | V201200 == 3
replace ideo4cat = 2 if V201200 == 5 | V201200 == 6 | V201200 == 7
replace ideo4cat = 3 if V201200 == 4
replace ideo4cat = 4 if V201200 == 99

mi estimate: svy: mlogit ideo4cat c.ruralconsc##c.engagement i.male##c.engagement i.race##c.engagement c.age##c.engagement c.education##c.engagement c.income##c.engagement i.parent##c.engagement i.married##c.engagement i.union##c.engagement i.unemployed##c.engagement c.religion##c.engagement c.church##c.engagement c.antiblack_stereotyping##c.engagement i.state, baseoutcome(4)


***** Note: Appendix 4A included separately below, requires separate procedure due to different sample used. *****


***** Appendix 4B: Omit Anti-Rurally Conscious Respondents *****
foreach dv in latent_leftright econ_liberalism imports freetrade  {
quietly mi estimate: svy: regress `dv' c.ruralconsc_midup##c.engagement i.male##c.engagement i.race##c.engagement c.age##c.engagement c.education##c.engagement c.income##c.engagement i.parent##c.engagement i.married##c.engagement i.union##c.engagement i.unemployed##c.engagement c.religion##c.engagement c.church##c.engagement c.antiblack_stereotyping##c.engagement i.state
    quietly mimrgns, at(ruralconsc=(0 1) engagement=(.2666667 .4315 .596 .7605 .925)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]
}


***** Appendix 4C: Control for Racial Resentment *****
foreach dv in latent_leftright econ_liberalism imports freetrade  {
quietly mi estimate: svy: regress `dv' c.ruralconsc##c.engagement i.male##c.engagement i.race##c.engagement c.age##c.engagement c.education##c.engagement c.income##c.engagement i.parent##c.engagement i.married##c.engagement i.union##c.engagement i.unemployed##c.engagement c.religion##c.engagement c.church##c.engagement c.raceres##c.engagement i.state
    quietly mimrgns, at(ruralconsc=(.4444444 1) engagement=(.2666667 .4315 .596 .7605 .925)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]
}


***** Appendix 4D: Whites vs. Minorities ***** 

* Means of Rural Consciousness and Political Engagement 
mi estimate: svy: mean ruralconsc engagement if white == 1
mi estimate: svy: mean ruralconsc engagement if nonwhite == 1

* White Non-Hispanics
foreach dv in latent_leftright econ_liberalism imports freetrade  {
quietly mi estimate: svy: regress `dv' c.ruralconsc##c.engagement i.male##c.engagement c.age##c.engagement c.education##c.engagement c.income##c.engagement i.parent##c.engagement i.married##c.engagement i.union##c.engagement i.unemployed##c.engagement c.religion##c.engagement c.church##c.engagement c.antiblack_stereotyping##c.engagement i.state if white==1
    quietly mimrgns, at(ruralconsc=(.4444444 1) engagement=(.2666667 .4315 .596 .7605 .925)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]
}

* Racial/Ethnic Minorities
foreach dv in latent_leftright econ_liberalism imports freetrade  {
quietly mi estimate: svy: regress `dv' c.ruralconsc##c.engagement i.male##c.engagement i.race##c.engagement c.age##c.engagement c.education##c.engagement c.income##c.engagement i.parent##c.engagement i.married##c.engagement i.union##c.engagement i.unemployed##c.engagement c.religion##c.engagement c.church##c.engagement c.antiblack_stereotyping##c.engagement i.state if nonwhite==1
    quietly mimrgns, at(ruralconsc=(.4444444 1) engagement=(.2666667 .4315 .596 .7605 .925)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]
}


***** Appendix 4E: Political Engagement Subscales *****
sum polinterest knowledge, det

* Interest Subscale
foreach dv in latent_leftright econ_liberalism imports freetrade  {
quietly mi estimate: svy: regress `dv' c.ruralconsc##c.polinterest i.male##c.polinterest i.race##c.polinterest c.age##c.polinterest c.education##c.polinterest c.income##c.polinterest i.parent##c.polinterest i.married##c.polinterest i.union##c.polinterest i.unemployed##c.polinterest c.religion##c.polinterest c.church##c.polinterest c.antiblack_stereotyping##c.polinterest i.state
    quietly mimrgns, at(ruralconsc=(.4444444 1) polinterest=(.233 .412 .592 .771 .95)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]
}

* Knowledge Subscale
foreach dv in latent_leftright econ_liberalism imports freetrade  {
quietly mi estimate: svy: regress `dv' c.ruralconsc##c.knowledge i.male##c.knowledge i.race##c.knowledge c.age##c.knowledge c.education##c.knowledge c.income##c.knowledge i.parent##c.knowledge i.married##c.knowledge i.union##c.knowledge i.unemployed##c.knowledge c.religion##c.knowledge c.church##c.knowledge c.antiblack_stereotyping##c.knowledge i.state
    quietly mimrgns, at(ruralconsc=(.4444444 1) knowledge=(.25 .438 .625 .813 1)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]
}


***** Appendix 4F: Binning Estimator *****
mi svyset [pweight = weight] // drop complex sampling design for small subgroup estimation (SEs will be slightly off, but nbd for comparing binned vs linear predictions).

foreach num in 1 2 3 4 {
quietly mi estimate: svy: regress latent_leftright c.ruralconsc i.male i.race c.age c.education c.income i.parent i.married i.union i.unemployed_household c.antiblack_stereotyping c.religion c.church i.state if engagement4==`num'
quietly mimrgns, at(ruralconsc=(.4444444 1)) post
lincom _b[2._at]-_b[1._at]
}

foreach num in 1 2 3 4 {
quietly mi estimate: svy: regress econ_liberalism c.ruralconsc i.male i.race c.age c.education c.income i.parent i.married i.union i.unemployed_household c.antiblack_stereotyping c.religion c.church i.state if engagement4==`num'
quietly mimrgns, at(ruralconsc=(.4444444 1)) post
lincom _b[2._at]-_b[1._at]
}

foreach num in 1 2 3 4 {
quietly mi estimate: svy: regress imports c.ruralconsc i.male i.race c.age c.education c.income i.parent i.married i.union i.unemployed_household c.antiblack_stereotyping c.religion c.church i.state if engagement4==`num'
quietly mimrgns, at(ruralconsc=(.4444444 1)) post
lincom _b[2._at]-_b[1._at]
}

foreach num in 1 2 3 4 {
quietly mi estimate: svy: regress freetrade c.ruralconsc i.male i.race c.age c.education c.income i.parent i.married i.union i.unemployed_household c.antiblack_stereotyping c.religion c.church i.state if engagement4==`num'
quietly mimrgns, at(ruralconsc=(.4444444 1)) post
lincom _b[2._at]-_b[1._at]
}

* Grab Bin Medians, Calculate Linear Predictions at Bin Medians 
sum engagement if engagement4==1, det
sum engagement if engagement4==2, det
sum engagement if engagement4==3, det
sum engagement if engagement4==4, det

foreach dv in latent_leftright econ_liberalism imports freetrade  {
quietly mi estimate: svy: regress `dv' c.ruralconsc##c.engagement i.male##c.engagement i.race##c.engagement c.age##c.engagement c.education##c.engagement c.income##c.engagement i.parent##c.engagement i.married##c.engagement i.union##c.engagement i.unemployed_household##c.engagement c.antiblack_stereotyping##c.engagement c.religion##c.engagement c.church##c.engagement i.state
quietly mimrgns, at(ruralconsc=(.4444444 1) engagement=(.1916667 .4166667 .6291667 .8458334)) post
    lincom _b[5._at]-_b[1._at]
    lincom _b[6._at]-_b[2._at]
    lincom _b[7._at]-_b[3._at]
    lincom _b[8._at]-_b[4._at]
}


***** Appendix 4G: Rural Consciousness Facets *****
mi svyset [pweight = weight], psu(psu) strata(strata) // add back in complex sampling design

* Cultural Facet
foreach dv in latent_leftright econ_liberalism imports freetrade  {
quietly mi estimate: svy: regress `dv' c.ruralconsc_cultural##c.engagement i.male##c.engagement i.race##c.engagement c.age##c.engagement c.education##c.engagement c.income##c.engagement i.parent##c.engagement i.married##c.engagement i.union##c.engagement i.unemployed##c.engagement c.religion##c.engagement c.church##c.engagement c.antiblack_stereotyping##c.engagement i.state
    quietly mimrgns, at(ruralconsc=(.4444444 1) engagement=(.2666667 .4315 .596 .7605 .925)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]
}

* Political Facet
foreach dv in latent_leftright econ_liberalism imports freetrade  {
quietly mi estimate: svy: regress `dv' c.ruralconsc_political##c.engagement i.male##c.engagement i.race##c.engagement c.age##c.engagement c.education##c.engagement c.income##c.engagement i.parent##c.engagement i.married##c.engagement i.union##c.engagement i.unemployed##c.engagement c.religion##c.engagement c.church##c.engagement c.antiblack_stereotyping##c.engagement i.state
    quietly mimrgns, at(ruralconsc=(.4444444 1) engagement=(.2666667 .4315 .596 .7605 .925)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]
}

* Economic Facet
foreach dv in latent_leftright econ_liberalism imports freetrade  {
quietly mi estimate: svy: regress `dv' c.ruralconsc_economic##c.engagement i.male##c.engagement i.race##c.engagement c.age##c.engagement c.education##c.engagement c.income##c.engagement i.parent##c.engagement i.married##c.engagement i.union##c.engagement i.unemployed##c.engagement c.religion##c.engagement c.church##c.engagement c.antiblack_stereotyping##c.engagement i.state
    quietly mimrgns, at(ruralconsc=(.4444444 1) engagement=(.2666667 .4315 .596 .7605 .925)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]
}


***** Appendix 4H: Potential Ancestral Southern Democrats *****
mi svyset [pweight = weight] // drop complex sampling design for small subgroup estimation

* Non-Ancestral
foreach dv in latent_leftright econ_liberalism imports freetrade {
quietly mi estimate: svy: regress `dv' c.ruralconsc##c.engagement i.male##c.engagement c.age##c.engagement c.education##c.engagement c.income##c.engagement i.parent##c.engagement i.married##c.engagement i.union##c.engagement i.unemployed##c.engagement c.religion##c.engagement c.church##c.engagement c.antiblack_stereotyping##c.engagement i.state if ancestral == 0
    quietly mimrgns, at(ruralconsc=(.4444444 1) engagement=(.2666667 .4315 .596 .7605 .925)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]
}

* Ancestral
foreach dv in latent_leftright econ_liberalism imports freetrade {
quietly mi estimate: svy: regress `dv' c.ruralconsc##c.engagement i.male##c.engagement c.age##c.engagement c.education##c.engagement c.income##c.engagement i.parent##c.engagement i.married##c.engagement i.union##c.engagement i.unemployed##c.engagement c.religion##c.engagement c.church##c.engagement c.antiblack_stereotyping##c.engagement i.state if ancestral == 1
    quietly mimrgns, at(ruralconsc=(.4444444 1) engagement=(.2666667 .4315 .596 .7605 .925)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]
}


***** Note: Appendix 4I included separately below, requires dropping multiple imputation. *****


***** Appendix 4J: Rural vs. Small-Town ***********

* Small-Town
foreach dv in latent_leftright econ_liberalism imports freetrade  {
quietly mi estimate: svy: regress `dv' c.ruralconsc##c.engagement i.male##c.engagement i.race##c.engagement c.age##c.engagement c.education##c.engagement c.income##c.engagement i.parent##c.engagement i.married##c.engagement i.union##c.engagement i.unemployed##c.engagement c.religion##c.engagement c.church##c.engagement c.antiblack_stereotyping##c.engagement i.state if smalltown==1
    quietly mimrgns, at(ruralconsc=(.4444444 1) engagement=(.2666667 .4315 .596 .7605 .925)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]
}

* Rural
foreach dv in latent_leftright econ_liberalism imports freetrade  {
quietly mi estimate: svy: regress `dv' c.ruralconsc##c.engagement i.male##c.engagement i.race##c.engagement c.age##c.engagement c.education##c.engagement c.income##c.engagement i.parent##c.engagement i.married##c.engagement i.union##c.engagement i.unemployed##c.engagement c.religion##c.engagement c.church##c.engagement c.antiblack_stereotyping##c.engagement i.state if smalltown==0
    quietly mimrgns, at(ruralconsc=(.4444444 1) engagement=(.2666667 .4315 .596 .7605 .925)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]
}


***** Appendix 4K: Regional Differences *****
mi svyset [pweight = weight]

* Northeast
foreach dv in latent_leftright econ_liberalism imports freetrade {
quietly mi estimate: svy: regress `dv' c.ruralconsc##c.engagement i.male##c.engagement c.age##c.engagement c.education##c.engagement c.income##c.engagement i.parent##c.engagement i.married##c.engagement i.union##c.engagement i.unemployed##c.engagement c.religion##c.engagement c.church##c.engagement c.antiblack_stereotyping##c.engagement i.state if V203003 == 1
    quietly mimrgns, at(ruralconsc=(.4444444 1) engagement=(.2666667 .4315 .596 .7605 .925)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]
}

* Midwest
foreach dv in latent_leftright econ_liberalism imports freetrade {
quietly mi estimate: svy: regress `dv' c.ruralconsc##c.engagement i.male##c.engagement c.age##c.engagement c.education##c.engagement c.income##c.engagement i.parent##c.engagement i.married##c.engagement i.union##c.engagement i.unemployed##c.engagement c.religion##c.engagement c.church##c.engagement c.antiblack_stereotyping##c.engagement i.state if V203003 == 2
    quietly mimrgns, at(ruralconsc=(.4444444 1) engagement=(.2666667 .4315 .596 .7605 .925)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]
}

* South
foreach dv in latent_leftright econ_liberalism imports freetrade {
quietly mi estimate: svy: regress `dv' c.ruralconsc##c.engagement i.male##c.engagement c.age##c.engagement c.education##c.engagement c.income##c.engagement i.parent##c.engagement i.married##c.engagement i.union##c.engagement i.unemployed##c.engagement c.religion##c.engagement c.church##c.engagement c.antiblack_stereotyping##c.engagement i.state if V203003 == 3
    quietly mimrgns, at(ruralconsc=(.4444444 1) engagement=(.2666667 .4315 .596 .7605 .925)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]
}

* West
foreach dv in latent_leftright econ_liberalism imports freetrade {
quietly mi estimate: svy: regress `dv' c.ruralconsc##c.engagement i.male##c.engagement c.age##c.engagement c.education##c.engagement c.income##c.engagement i.parent##c.engagement i.married##c.engagement i.union##c.engagement i.unemployed##c.engagement c.religion##c.engagement c.church##c.engagement c.antiblack_stereotyping##c.engagement i.state if V203003 == 4
    quietly mimrgns, at(ruralconsc=(.4444444 1) engagement=(.2666667 .4315 .596 .7605 .925)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]
}


*****************************************************************************************************************
* Note: Appendix 4L cannot be included in the reproduction files because it requires the restricted ANES geocodes. 
* To reproduce these analyses, you will need to request access to the 2020 ANES geocodes from ICPSR. 
* Then simply merge 2010-2020 Census data and use the county geocodes to create two variables: 
* (1) respondent lives in a county whose population grew faster (1) vs. slower (0) than the US average 2010-2020.
* (2) respondent lives in a county whose population grew (1) vs. declined (0) 2010-2020.
* Re-run the main regression models, subsetting to each of these four groups. 
*****************************************************************************************************************


***** Appendix 4M: Baseline Model *****
foreach dv in latent_leftright econ_liberalism imports freetrade  {
quietly mi estimate: svy: regress `dv' c.ruralconsc##c.engagement 
    quietly mimrgns, at(ruralconsc=(.4444444 1) engagement=(.2666667 .4315 .596 .7605 .925)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]
}


***** Appendix 6: Adding Controls for Partisan-Ideological Orientation *****
quietly mi estimate: svy: regress econ_liberalism c.ruralconsc##c.engagement i.male##c.engagement c.age##c.engagement c.education##c.engagement c.income##c.engagement i.parent##c.engagement i.married##c.engagement i.union##c.engagement i.unemployed##c.engagement c.religion##c.engagement c.church##c.engagement c.antiblack_stereotyping##c.engagement i.state
    quietly mimrgns, at(ruralconsc=(.4444444 1) engagement=(.2666667 .4315 .596 .7605 .925)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]
quietly mi estimate: svy: regress econ_liberalism c.ruralconsc##c.engagement i.male##c.engagement c.age##c.engagement c.education##c.engagement c.income##c.engagement i.parent##c.engagement i.married##c.engagement i.union##c.engagement i.unemployed##c.engagement c.religion##c.engagement c.church##c.engagement c.antiblack_stereotyping##c.engagement i.state c.latent_leftright
    quietly mimrgns, at(ruralconsc=(.4444444 1) engagement=(.2666667 .4315 .596 .7605 .925)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]

quietly mi estimate: svy: regress imports c.ruralconsc##c.engagement i.male##c.engagement c.age##c.engagement c.education##c.engagement c.income##c.engagement i.parent##c.engagement i.married##c.engagement i.union##c.engagement i.unemployed##c.engagement c.religion##c.engagement c.church##c.engagement c.antiblack_stereotyping##c.engagement i.state
    quietly mimrgns, at(ruralconsc=(.4444444 1) engagement=(.2666667 .4315 .596 .7605 .925)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]
quietly mi estimate: svy: regress imports c.ruralconsc##c.engagement i.male##c.engagement c.age##c.engagement c.education##c.engagement c.income##c.engagement i.parent##c.engagement i.married##c.engagement i.union##c.engagement i.unemployed##c.engagement c.religion##c.engagement c.church##c.engagement c.antiblack_stereotyping##c.engagement i.state c.latent_leftright
    quietly mimrgns, at(ruralconsc=(.4444444 1) engagement=(.2666667 .4315 .596 .7605 .925)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]

quietly mi estimate: svy: regress freetrade c.ruralconsc##c.engagement i.male##c.engagement c.age##c.engagement c.education##c.engagement c.income##c.engagement i.parent##c.engagement i.married##c.engagement i.union##c.engagement i.unemployed##c.engagement c.religion##c.engagement c.church##c.engagement c.antiblack_stereotyping##c.engagement i.state
    quietly mimrgns, at(ruralconsc=(.4444444 1) engagement=(.2666667 .4315 .596 .7605 .925)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]
quietly mi estimate: svy: regress freetrade c.ruralconsc##c.engagement i.male##c.engagement c.age##c.engagement c.education##c.engagement c.income##c.engagement i.parent##c.engagement i.married##c.engagement i.union##c.engagement i.unemployed##c.engagement c.religion##c.engagement c.church##c.engagement c.antiblack_stereotyping##c.engagement i.state c.latent_leftright
    quietly mimrgns, at(ruralconsc=(.4444444 1) engagement=(.2666667 .4315 .596 .7605 .925)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]

* Note: SE of differences across models calculated with p=0.5 correlation (assumed) but does not have a major effect being more or less conservative about choice of p. 


***** Appendix 4I: Results w/o Multiple Imputation *****

use ANES2020_Coded, clear // reload data, clears multiple imputation
svyset [pweight = weight], psu(psu) strata(strata)

foreach dv in latent_leftright econ_liberalism imports freetrade {
quietly svy: regress `dv' c.ruralconsc##c.engagement i.male##c.engagement i.race##c.engagement c.age##c.engagement c.education##c.engagement c.income##c.engagement i.parent##c.engagement i.married##c.engagement i.union##c.engagement i.unemployed##c.engagement c.religion##c.engagement c.church##c.engagement c.antiblack_stereotyping##c.engagement i.state
    quietly margins, at(ruralconsc=(.4444444 1) engagement=(.2666667 .4315 .596 .7605 .925)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]
}


***** Appendix 5: Political Engagement *******

* Create Closest Equivalent Engagement Scales/Subscales
alpha interest attention, gen(interest_comp)

gen know9 = 1 if V202218 == 2
replace know9 = 0 if V202218 != 2

alpha know1 know2 know9 know8 know4, gen(know_lucid)
alpha know1 know6 know8, gen(know_pilot)
alpha know2 know3, gen(know_ces)

alpha know_lucid interest_comp, gen(engage_lucid)
alpha know_pilot interest_comp, gen(engage_pilot)
alpha know_ces interest_comp, gen(engage_ces)

svy: mean interest_comp
svy: mean know_lucid
svy: mean know_pilot
svy: mean know_ces
svy: mean engage_lucid
svy: mean engage_pilot
svy: mean engage_ces


/***** Appendix 4A: Rural Resident (vs. Identifier) Inclusion Criteria *****

* Note: Every other analysis above is among rural identifiers, so the coding file omits non-rural identifiers from the get go.
* To run this analysis which includes non-rural identifiers, follow these steps. 
* First, go into the coding file and comment out line 34: "drop if rural_person !=1 // Remove Non-Rural/Non-Small Town Folks"
* Second, run the entire coding file to regenerate the coded dataset with non-rural identifiers in it. 
* Third, return to this section of the analysis file and run it separately from everything above here.
* Fourth, once you're done, remember to uncomment that line and regenerate the right dataset for all other analyses.  

drop if rural_location==0 & if rural_person==0

set seed 1996
mi set wide
mi register imputed income male black hispanic asian native education parent married union unemployed_household age antiblack_stereotyping religion church poorhealth raceres ownstock class
mi impute chained (logit) male black hispanic asian native parent married union unemployed_household ownstock (reg) income education age antiblack_stereotyping religion church poorhealth raceres class, add(25)

mi svyset [pweight = weight], psu(psu) strata(strata)

* Rural Residents Only 
sum ruralconsc engagement [aweight=weight] if rural_location==1 , det
foreach dv in latent_leftright econ_liberalism imports freetrade  {
quietly mi estimate: svy: regress `dv' c.ruralconsc##c.engagement i.male##c.engagement i.race##c.engagement c.age##c.engagement c.education##c.engagement c.income##c.engagement i.parent##c.engagement i.married##c.engagement i.union##c.engagement i.unemployed##c.engagement c.religion##c.engagement c.church##c.engagement c.antiblack_stereotyping##c.engagement i.state if rural_location==1
    quietly mimrgns, at(ruralconsc=(.4444444 1) engagement=(0.2333333 0.402083 0.57083 0.73958 .9083334)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]
}

* Rural Residents + Identifiers
sum ruralconsc engagement [aweight=weight] if rural_location==1 & rural_person==1, det
foreach dv in latent_leftright econ_liberalism imports freetrade  {
quietly mi estimate: svy: regress `dv' c.ruralconsc##c.engagement i.male##c.engagement i.race##c.engagement c.age##c.engagement c.education##c.engagement c.income##c.engagement i.parent##c.engagement i.married##c.engagement i.union##c.engagement i.unemployed##c.engagement c.religion##c.engagement c.church##c.engagement c.antiblack_stereotyping##c.engagement i.state if rural_location==1 & rural_person==1
    quietly mimrgns, at(ruralconsc=(0.5 1) engagement=(.2375 0.403125 0.56875 0.734375 .90)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]
}


